package com.supper.annotation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author yutao
 * @since 2020/4/13 2:47 下午
 */
@Component
public class PersonAnn {

    @Autowired
    private CarAnn carAnn;

    public PersonAnn() {
        System.out.println("无参构造注入");
    }

    public PersonAnn(CarAnn carAnn) {
        this.carAnn = carAnn;
        System.out.println("有参构造注入");
    }

    public void setCarAnn(CarAnn carAnn) {
        this.carAnn = carAnn;
        System.out.println("setter注入");
    }

    public CarAnn getCarAnn() {
        return carAnn;
    }

    @Override
    public String toString() {
        return "PersonAnn{" +
                "carAnn=" + carAnn +
                '}';
    }
}
